<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>美多转盘抽奖代码</title>
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/Rotate.js"></script>

<link rel="stylesheet" type="text/css" href="css/reset.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<script type="text/javascript" src="js/host.js"></script>
<script type="text/javascript" src="js/vue-2.5.16.js"></script>
<script type="text/javascript" src="js/axios-0.18.0.min.js"></script>

<style>
*{padding:0; margin:0;}
.lotteryMain{ width:100%; padding:10px 0; }
.lotteryBg{ width:520px; height:520px; margin:0 auto; background:url(images/lotteryBg.jpg) no-repeat; position:relative; overflow:hidden; z-index:1}
#run{ width:153px; height:214px; position:absolute; left:50%; top:50%;  margin-left:-76px; margin-top:-107px; z-index:2; transform:rotate(0deg); -ms-transform:rotate(0deg); }
#btn_run{ width:125px; height:125px; background:url(images/btn_start.png) no-repeat; border:none; outline:none; position:absolute; left:50%; top:50%; margin-left:-62px; margin-top:-62px; z-index:2;cursor:pointer;}
.order_submita{width:1200px;margin:20px auto;}
.order_submita a{width:160px;height:40px;line-height:40px;text-align:center;background-color:#fe0000;color:#fff;font-size:16px;display:block;float:right}
</style>
</head>

<body>
<div id="app">
    <div class="header_con">
        <div class="header">
            <div class="welcome fl">欢迎来到美多商城!</div>
            <div class="fr">
                <div class="user_link fl">
                    <span>|</span>
                    <a href="user_center_info.html">用户中心</a>
                    <span>|</span>
                    <a href="cart.html">我的购物车</a>
                    <span>|</span>
                    <a href="user_center_order.html">我的订单</a>
                </div>
            </div>
        </div>
    </div>

    <div class="search_bar clearfix">
        <a href="index.html" class="logo fl"><img src="images/logo.png"></a>
        <div class="sub_page_name fl">|&nbsp;&nbsp;&nbsp;&nbsp;抽奖活动</div>
        <form method="get" action="/search.html" class="search_con fr mt40">
            <input type="text" class="input_text fl" name="q" placeholder="搜索商品">
            <input type="submit" class="input_btn fr" name="" value="搜索">
        </form>
    </div>

<section class="lotteryMain">
	<div class="lotteryBg">
    	<img id="run" src="images/start.png" />
        <input id="btn_run" type="button" value="" />
    </div>
</section>

<script>
$(function(){
     $("#btn_run").click(function(){
		$("#btn_run").attr('disabled',true).css("cursor","default");
        lottery();
    });
});
function lottery(){
    $.ajax({
        type: 'get',
        url: 'json.js',
        dataType: 'json',
        cache: false,
        error: function(){return false;},
        success:function(obj){
				$("#run").rotate({
					duration:3000, //转动时间
					angle: 0, //默认角度
					animateTo:360*6+obj.rotate, //转动角度
					easing: $.easing.easeOutSine,
					callback: function(){
						alert(obj.results);
						$("#btn_run").attr('disabled',false).css("cursor","pointer");
					}
				});
        }
    });
};

</script>
    <div class="footer">
        <div class="foot_link">
            <a href="#">关于我们</a>
            <span>|</span>
            <a href="#">联系我们</a>
            <span>|</span>
            <a href="#">招聘人才</a>
            <span>|</span>
            <a href="#">友情链接</a>
        </div>
        <p>CopyRight © 2016 北京美多商业股份有限公司 All Rights Reserved</p>
        <p>电话：010-****888    京ICP备*******8号</p>
    </div>
    </div>
    <script type="text/javascript">
        var vm = new Vue({
            el: '#app',
            data: {
                host,
                trade_id: '',
            },
            mounted: function(){
                axios.put(this.host+'/pay/status/'+document.location.search,{}, {
                        responseType: 'json'
                    })
                    .then(response => {
                        this.trade_id = response.data.trade_id;
                    })
                    .catch(error => {
                        console.log(error.response);
                    })
            }
        })
    </script>
</body>
</html>
